﻿using System.Text;

namespace CommonUtils
{
    public static class Encodings
    {
        public static Encoding GB2312 => TextEncoding.GB2312;

        public static Encoding GBK => TextEncoding.GBK;

        public static Encoding Default => Encoding.Default;

        public static Encoding Unicode => Encoding.Unicode;

        public static Encoding ASCII => Encoding.ASCII;

        //这个带BOM Preamble = "System.ReadOnlySpan<Byte>[3]" 
        public static Encoding UTF8 { get; } = Encoding.UTF8;

        //这个带BOM Preamble = "System.ReadOnlySpan<Byte>[3]"
        public static Encoding UTF8Bom { get; } = new UTF8Encoding(true);

        //这个不带BOM Preamble = "System.ReadOnlySpan<Byte>[0]"
        public static Encoding UTF8NoBom { get; } = new UTF8Encoding(false);
    }
}
